package com.wwwarehouse.taskcenter.fragment.invite_business_information;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSON;
import com.wwwarehouse.common.activity.BaseCardDeskActivity;
import com.wwwarehouse.common.activity.base.BaseApplication;
import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.common.bean.filter.FilterBean;
import com.wwwarehouse.common.bean.response.CommonClass;
import com.wwwarehouse.common.constant.Constant;
import com.wwwarehouse.common.custom_widget.CircleImageView;
import com.wwwarehouse.common.custom_widget.ElasticScrollView;
import com.wwwarehouse.common.custom_widget.state_layout.StateLayout;
import com.wwwarehouse.common.eventbus_event.DrawerMultipleCompleteEvent;
import com.wwwarehouse.common.eventbus_event.DrawerMultipleResetEvent;
import com.wwwarehouse.common.fragment.DeskDrawerMultipleFragment;
import com.wwwarehouse.common.http.NoHttpUtils;
import com.wwwarehouse.common.tools.LogUtils;
import com.wwwarehouse.taskcenter.R;
import com.wwwarehouse.taskcenter.bean.BussUnitsByUserBean;
import com.wwwarehouse.taskcenter.bean.InviteRankFilterBean;
import com.wwwarehouse.taskcenter.bean.InviteRankOrderBean;
import com.wwwarehouse.taskcenter.bean.InviteRankPageBean;
import com.wwwarehouse.taskcenter.bean.InviterRankBean;
import com.wwwarehouse.taskcenter.constant.TaskCenterConstant;
import com.wwwarehouse.taskcenter.custom_view.HorizontalNumView;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

import de.greenrobot.event.EventBus;

/**
 * @创建者 chenchao.
 * @创建时间 2017/10/9 16:19
 * @描述 ${TODO}
 */
@Route(path = TaskCenterConstant.InviteRankingFragment)
public class InviteRankingFragment extends BaseFragment implements View.OnClickListener {

    private View                           mView;
    private TextView                       mTvDay;
    private TextView                       mTvWeek;
    private TextView                       mTvMonth;
    private TextView                       mTvYear;
    private ImageView                      mIvLeft;
    private ImageView                      mIvRight;
    private TextView                       mTvData;
    private String                         mYear;
    private String                         mMonth;
    private String                         mDay;
    private String                         mStartWeek;
    private String                         mEndWeek;
    private CircleImageView                mCiv1;
    private CircleImageView                mCiv2;
    private CircleImageView                mCiv3;
    private CircleImageView                mCiv4;
    private CircleImageView                mCiv5;
    private CircleImageView                mCiv6;
    private CircleImageView                mCiv7;
    private CircleImageView                mCiv8;
    private TextView                       mTv1;
    private TextView                       mTv2;
    private TextView                       mTv3;
    private TextView                       mTv4;
    private TextView                       mTv5;
    private TextView                       mTv6;
    private TextView                       mTv7;
    private TextView                       mTv8;
    private HorizontalNumView              mHnv1;
    private HorizontalNumView              mHnv2;
    private HorizontalNumView              mHnv3;
    private HorizontalNumView              mHnv4;
    private HorizontalNumView              mHnv5;
    private HorizontalNumView              mHnv6;
    private HorizontalNumView              mHnv7;
    private HorizontalNumView              mHnv8;
    private ElasticScrollView              mEsv;
    private StateLayout                    mStateLayout;
    private List<FilterBean>               mFilterList;
    private Calendar                       mCalendarDay;
    private Calendar                       mCalendarDay1;
    private Calendar                       mCalendarDay2;
    private Calendar                       mCalendarWeek;
    private Calendar                       mCalendarMonth;
    private Calendar                       mCalendarMonth1;
    private Calendar                       mCalendarMonth2;
    private Calendar                       mCalendarYear;
    private Calendar                       mCalendarYear1;
    private Calendar                       mCalendarYear2;
    private Calendar                       mCalendar1;
    private SimpleDateFormat               mSdfYear;
    private SimpleDateFormat               mSdfMonth;
    private SimpleDateFormat               mDateFormater;
    private Date                           mBeginDate;
    private TextView                       mTvTotalNum;
    private TextView                       mTvMore;
    private ImageView                      mFilterBtInSearchTitle;
    private Map                            mInviteRankingMap;
    private List<InviteRankFilterBean>     mInviteRankFilterList;
    private InviteRankFilterBean           mInviteRankFilterBean1;
    private ArrayList<BussUnitsByUserBean> mBussUnitsList;
    private SimpleDateFormat               mSdfYearDate;
    private SimpleDateFormat               mSdfMonthDate;
    private SimpleDateFormat               mDataFormatDate;
    private SimpleDateFormat               mDataFormatDateEnd;
    private String                         mYearDate;
    private String                         mMonthDate;
    private String                         mDayDate;
    private String                         mStartWeekDate;
    private String                         mEndWeekDate;
    private InviteRankFilterBean           mInviteRankFilterBean3;
    private InviteRankFilterBean           mInviteRankFilterBean4;
    private InviteRankPageBean             mInviteRankPageBean;
    private List<String>                   mSelectsList;
    private InviteRankOrderBean            mInviteRankOrderBean;
    private LinearLayout                   mLlNoData;
    private InviteRankFilterBean           mInviteRankFilterBean2;
    private List<InviteRankOrderBean>      mOrderList;
    private LinearLayout                   mLlData;
    private InviteRankFilterBean           mInviteRankFilterBean6;
    private InviteRankFilterBean           mInviteRankFilterBean5;
    private boolean                        isDay;
    private boolean isWeek = true;
    private boolean isMonth;
    private boolean isYear;
    private int day   = 0;
    private int week  = 0;
    private int month = 0;
    private int year  = 0;
    private List<InviterRankBean.ListBean> mDataList;
    private List<String>                   mBussUnitValueList;
    private ImageView                      mNo1;
    private ImageView                      mNo2;
    private ImageView                      mNo3;
    private List<String>                   mSumsList;
    private String                         mEndMonthData;
    private String                         mEndYearData;
    private String                         mStartMonthData;
    private String                         mStartYearData;
    private String                         mEndDayData;


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_invite_ranking, container, false);
        return mView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
        initData();
    }

    private void initData() {
        getInviteRankOrderBean();//降升序
        getSelectsList();//最后一个集合
        //抽屉的集合
        mFilterList = new ArrayList<>();
        //UnitId
        mBussUnitValueList = new ArrayList();
        mInviteRankingMap = new HashMap();
        //筛选条件的集合
        mInviteRankFilterList = new ArrayList<>();
        mEsv.setOnPullListener(new ElasticScrollView.OnPullListener() {
            @Override
            public void onDownPull() {
                ((BaseCardDeskActivity) mActivity).downPull_4();
                ((BaseCardDeskActivity) mActivity).showFilterBt();
                ((BaseCardDeskActivity) mActivity).hideSortBt();
                ((BaseCardDeskActivity) mActivity).hideSearchImgV();
//                ((BaseCardDeskActivity) mActivity).showFilterBt();
                //                ((BaseCardDeskActivity) mActivity).getSearchImgV().setVisibility(View.INVISIBLE);
                //                ((BaseCardDeskActivity) mActivity).getSortBt().setVisibility(View.INVISIBLE);
                //                mFilterBtInSearchTitle = ((BaseCardDeskActivity) mActivity).getFilterBtInSearchTitle();
                //                if (mFilterBtInSearchTitle.getVisibility() == View.GONE) {
                //                    mFilterBtInSearchTitle.setVisibility(View.VISIBLE);
                //                }
                //                mFilterBtInSearchTitle.setOnClickListener(new View.OnClickListener() {
                //                    @Override
                //                    public void onClick(View v) {
                //                        ((BaseCardDeskActivity) mActivity).showDrawerLayout();
                //                    }
                //                });
            }

            @Override
            public void onUpPull() {

            }
        });


        //得到当前所有的时间
        getCurData();

    }

    @Override
    public void filterClick() {
        //        super.filterClick();
        if (peekFragment() instanceof InviteRankingFragment) {
            ((BaseCardDeskActivity) mActivity).showDrawerLayout();
        }
    }

    @Override
    public void setTitle() {
        if (peekFragment() instanceof InviteRankingFragment) {
            mActivity.setTitle(R.string.inviter_rank);
        }
    }

    @Override
    public void requestDatas() {
        getBussUnits();
        LogUtils.showLog(sp.getValue(Constant.sp_Token) + "    chenchao");
    }

    private void getBussUnits() {
        //先查询用户所有的业务单位
        Map noMap = new HashMap();
        mStateLayout.showProgressView(true);
        NoHttpUtils.httpPost(TaskCenterConstant.BUSINESS_UNITS_BY_USER, noMap, mOnResponseListener, 0);
    }

    private NoHttpUtils.OnResponseListener mOnResponseListener = new NoHttpUtils.OnResponseListener() {
        @Override
        public void onSucceed(CommonClass commonClass, int i) {
            try {
                switch (i) {
                    case 0:
                        if ("0".equals(commonClass.getCode())) {
                            mBussUnitsList = (ArrayList<BussUnitsByUserBean>) JSON.parseArray(commonClass.getData().toString(), BussUnitsByUserBean.class);
                            if (mBussUnitsList.size() > 0) {
                                mFilterList.clear();
                                mBussUnitValueList.clear();
                                for (int j = 0; j < mBussUnitsList.size(); j++) {
                                    mFilterList.add(new FilterBean(false, mBussUnitsList.get(j).getBuName()));//抽屉里面的集合赋值
                                    mBussUnitValueList.add(mBussUnitsList.get(j).getBuId() + "");
                                }
                                DeskDrawerMultipleFragment deskDrawerMultipleFragment = DeskDrawerMultipleFragment.newInstance(getString(R.string.business_unit), mFilterList, 1);
                                ((BaseCardDeskActivity) mActivity).setDrawerLayout(deskDrawerMultipleFragment);
                                getWeekRank();
                            } else {
                                mStateLayout.showEmptyView(true);//请求回来为空
                                mStateLayout.setEmptyListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        getBussUnits();
                                    }
                                });
                            }
                        }
                        break;
                    case 1:
                        if ("0".equals(commonClass.getCode())) {
                            InviterRankBean inviterRankBean = JSON.parseObject(commonClass.getData().toString(), InviterRankBean.class);
                            mDataList = inviterRankBean.getList();
                            mTvTotalNum.setText(inviterRankBean.getSumList().getRegisterQty());
                            if (mDataList.size() > 0) {
                                setAllInvisible();
                                setRank();
                            } else {
                                mLlNoData.setVisibility(View.VISIBLE);
                                mLlData.setVisibility(View.INVISIBLE);
                            }
                        } else {

                        }
                        break;
                }
            } catch (Exception e) {
                LogUtils.showLog(e.toString());
            }
        }

        @Override
        public void onFailed(String s, final int i) {

            mStateLayout.showNetworkView(true);//网络问题
            mStateLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    switch (i) {
                        case 0:
                            getBussUnits();
                            break;
                        case 1:
                            if (isDay) {
                                getDayRank();
                            } else if (isWeek) {
                                getWeekRank();
                            } else if (isMonth) {
                                getMonthRank();
                            } else if (isYear) {
                                getYearRank();
                            }
                            break;
                    }

                }
            });

        }

        @Override
        public void onFinish(int i) {
            mStateLayout.showContentView();
            dismissProgressDialog();
        }
    };


    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.tv_day) {
            // 获取当日期
            mDayDate = mDataFormatDate.format(new Date());
            mDay = mDateFormater.format(new Date());

            mCalendarDay2 = Calendar.getInstance(Locale.CHINA);
            mCalendarDay2.add(Calendar.DATE, 1);
            mEndDayData = mDataFormatDate.format(mCalendarDay2.getTime());
            LogUtils.showLog("R.id.tv_day" + "    " + mDayDate + "      " + mEndDayData);

            day = 0;
            setEveryTvNormal();
            mTvDay.setBackground(mActivity.getResources().getDrawable(R.drawable.left_circle_c1_bg_shape));
            mTvDay.setTextColor(mActivity.getResources().getColor(R.color.common_color_c3_ffffff));
            mTvData.setText(mDay);
            isDay = true;
            getDayRank();
        } else if (id == R.id.tv_week) {
            week = 0;
            setEveryTvNormal();
            mTvWeek.setBackground(mActivity.getResources().getDrawable(R.drawable.rect_c1_bg_shape));
            mTvWeek.setTextColor(mActivity.getResources().getColor(R.color.common_color_c3_ffffff));

            //获取当前周
            mCalendarWeek.setFirstDayOfWeek(Calendar.MONDAY);
            //当前时间，貌似多余，其实是为了所有可能的系统一致
            mCalendarWeek.setTimeInMillis(System.currentTimeMillis());
            mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
            LogUtils.showLog(mDateFormater.format(mCalendarWeek.getTime()));
            mStartWeek = (mDateFormater.format(mCalendarWeek.getTime()));
            mStartWeekDate = mDataFormatDate.format(mCalendarWeek.getTime());
            mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
            mEndWeekDate = mDataFormatDateEnd.format(mCalendarWeek.getTime());
            mEndWeek = (mDateFormater.format(mCalendarWeek.getTime()));


            mTvData.setText(mStartWeek + "-" + mEndWeek);
            isWeek = true;
            getWeekRank();
        } else if (id == R.id.tv_month) {
            // 获取当前年月
            mSdfMonth = new SimpleDateFormat("yyyy年MM月");
            mSdfMonthDate = new SimpleDateFormat("yyyyMM");
            mMonthDate = mSdfMonthDate.format(new Date());
            mMonth = mSdfMonth.format(new Date());
//            mStartMonthData = mDataFormatDate.format(new Date());

            mCalendarMonth2 = Calendar.getInstance(Locale.CHINA);
            mCalendarMonth2.set(Calendar.DAY_OF_MONTH,mCalendarMonth2.getActualMaximum(Calendar.DAY_OF_MONTH));
            mEndMonthData = mDataFormatDateEnd.format(mCalendarMonth2.getTime());
            mCalendarMonth2.set(Calendar.DAY_OF_MONTH, 1);
            mStartMonthData = mDataFormatDate.format(mCalendarMonth2.getTime());
            LogUtils.showLog("R.id.tv_month" + "    " + mStartMonthData + "      " + mEndMonthData);

            month = 0;
            setEveryTvNormal();
            mTvMonth.setBackground(mActivity.getResources().getDrawable(R.drawable.rect_c1_bg_shape));
            mTvMonth.setTextColor(mActivity.getResources().getColor(R.color.common_color_c3_ffffff));
            mTvData.setText(mMonth);
            isMonth = true;
            getMonthRank();
        } else if (id == R.id.tv_year) {
            // 获取当前年
            mSdfYear = new SimpleDateFormat("yyyy年");
            mSdfYearDate = new SimpleDateFormat("yyyy");
            mYearDate = mSdfYearDate.format(new Date());
            mYear = mSdfYear.format(new Date());


            mCalendarYear2 = Calendar.getInstance(Locale.CHINA);
            mCalendarYear2.set(Calendar.DAY_OF_YEAR, mCalendarYear2.getActualMaximum(Calendar.DAY_OF_YEAR));
            mEndYearData = mDataFormatDateEnd.format(mCalendarYear2.getTime());
            mCalendarYear2.set(Calendar.DAY_OF_YEAR, 1);
            mStartYearData = mDataFormatDate.format(mCalendarYear2.getTime());
            LogUtils.showLog("R.id.tv_year" + "    " + mStartYearData + "      " + mEndYearData);

            year = 0;
            setEveryTvNormal();
            mTvYear.setBackground(mActivity.getResources().getDrawable(R.drawable.right_circle_c1_bg_shape));
            mTvYear.setTextColor(mActivity.getResources().getColor(R.color.common_color_c3_ffffff));
            mTvData.setText(mYear);
            isYear = true;
            getYearRank();
        } else if (id == R.id.iv_left) {
            if (isDay) {
                day = day - 1;
                getLessDay(day);
            } else if (isWeek) {
                week = week - 7;
                getLessWeek(week);
            } else if (isMonth) {
                month = month - 1;
                getLessMonth(month);
            } else if (isYear) {
                year = year - 1;
                getLessYear(year);
            }
        } else if (id == R.id.iv_right) {
            if (isDay) {
                day += 1;
                getMoreDay(day);
            } else if (isWeek) {
                week = week + 7;
                getMoreWeek(week);
            } else if (isMonth) {
                month = month + 1;
                getMoreMonth(month);
            } else if (isYear) {
                year = year + 1;
                getMoreYear(year);
            }
        } else if (id == R.id.tv_more) {
            Bundle moreBundle = new Bundle();
            if (isDay) {
                moreBundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
                moreBundle.putSerializable("mInviteRankFilterBean2", mInviteRankFilterBean2);
                moreBundle.putString("startTime", mDayDate);
                moreBundle.putString("endTime", mEndDayData);
                pushFragment(TaskCenterConstant.SelectInviterFragment, moreBundle);
            } else if (isWeek) {
                moreBundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
                moreBundle.putSerializable("mInviteRankFilterBean3", mInviteRankFilterBean3);
                moreBundle.putSerializable("mInviteRankFilterBean4", mInviteRankFilterBean4);
                moreBundle.putString("startTime", mStartWeekDate);
                moreBundle.putString("endTime", mEndWeekDate);
                pushFragment(TaskCenterConstant.SelectInviterFragment, moreBundle);
            } else if (isMonth) {
                moreBundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
                moreBundle.putSerializable("mInviteRankFilterBean5", mInviteRankFilterBean5);
                moreBundle.putString("startTime", mStartMonthData);
                moreBundle.putString("endTime", mEndMonthData);
                pushFragment(TaskCenterConstant.SelectInviterFragment, moreBundle);
            } else if (isYear) {
                moreBundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
                moreBundle.putSerializable("mInviteRankFilterBean6", mInviteRankFilterBean6);
                moreBundle.putString("startTime", mStartYearData);
                moreBundle.putString("endTime", mEndYearData);
                pushFragment(TaskCenterConstant.SelectInviterFragment, moreBundle);
            }
        } else if (id == R.id.ll1) {
            toInviteSuccessFragment(0);
        } else if (id == R.id.ll2) {
            toInviteSuccessFragment(1);
        } else if (id == R.id.ll3) {
            toInviteSuccessFragment(2);
        } else if (id == R.id.ll4) {
            toInviteSuccessFragment(3);
        } else if (id == R.id.ll5) {
            toInviteSuccessFragment(4);
        } else if (id == R.id.ll6) {
            toInviteSuccessFragment(5);
        } else if (id == R.id.ll7) {
            toInviteSuccessFragment(6);
        } else if (id == R.id.ll8) {
            toInviteSuccessFragment(7);
        }
    }

    private void toInviteSuccessFragment(int position) {
        Bundle bundle = new Bundle();
        bundle.putInt("inviterId", mDataList.get(position).getInviterId());
        bundle.putString("InviterName", mDataList.get(position).getInviterName());
        if (isDay) {
            bundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
            bundle.putSerializable("mInviteRankFilterBean2", mInviteRankFilterBean2);
            bundle.putString("startTime", mDayDate);
            bundle.putString("endTime", mEndDayData);
        } else if (isWeek) {
            bundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
            bundle.putSerializable("mInviteRankFilterBean3", mInviteRankFilterBean3);
            bundle.putSerializable("mInviteRankFilterBean4", mInviteRankFilterBean4);
            bundle.putString("startTime", mStartWeekDate);
            bundle.putString("endTime", mEndWeekDate);
        } else if (isMonth) {
            bundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
            bundle.putSerializable("mInviteRankFilterBean5", mInviteRankFilterBean5);
            bundle.putString("startTime", mStartMonthData);
            bundle.putString("endTime", mEndMonthData);
        } else if (isYear) {
            bundle.putSerializable("mInviteRankFilterBean1", mInviteRankFilterBean1);
            bundle.putSerializable("mInviteRankFilterBean6", mInviteRankFilterBean6);
            bundle.putString("startTime", mStartYearData);
            bundle.putString("endTime", mEndYearData);
        }
        pushFragment(TaskCenterConstant.InviteSuccessFragment, bundle);
    }

    //点击完成
    public void onEventMainThread(DrawerMultipleCompleteEvent event) {
        if (event != null && event.getSelectedPositionSet() != null) {
            Set<Integer> selectedPositionSet = event.getSelectedPositionSet();
            if (!selectedPositionSet.isEmpty()) {
                mBussUnitValueList.clear();
                for (Integer i : selectedPositionSet) {
                    mBussUnitValueList.add(mBussUnitsList.get(i).getBuId() + "");
                }
            } else {
                mBussUnitValueList.clear();
                for (int i = 0; i < mBussUnitsList.size(); i++) {
                    mBussUnitValueList.add(mBussUnitsList.get(i).getBuId() + "");
                }
            }
            if (isDay) {
                getDayRank();
            } else if (isWeek) {
                getWeekRank();
            } else if (isMonth) {
                getMonthRank();
            } else if (isYear) {
                getYearRank();
            }
        }

    }

    //点击重置
    public void onEventMainThread(DrawerMultipleResetEvent event) {
        ((BaseCardDeskActivity) mActivity).hideDrawerLayout();
        mBussUnitValueList.clear();
        for (int i = 0; i < mBussUnitsList.size(); i++) {
            mBussUnitValueList.add(mBussUnitsList.get(i).getBuId() + "");
        }
        if (isDay) {
            getDayRank();
        } else if (isWeek) {
            getWeekRank();
        } else if (isMonth) {
            getMonthRank();
        } else if (isYear) {
            getYearRank();
        }
    }

    private void getDayRank() {
        getUnitIdList1();//为mInviteRankFilterList准备参数
        getDayList2();
        mInviteRankFilterList.clear();
        mInviteRankFilterList.add(mInviteRankFilterBean1);
        mInviteRankFilterList.add(mInviteRankFilterBean2);
        mInviteRankingMap.put("dataSet", "inviter_day");
        mInviteRankingMap.put("filters", mInviteRankFilterList);
        mInviteRankingMap.put("ifCount", "true");
        mInviteRankingMap.put("ifDistinct", "true");
        mInviteRankingMap.put("page", 1);
        mInviteRankingMap.put("size", 8);
        mInviteRankingMap.put("orders", mOrderList);
        mInviteRankingMap.put("selects", mSelectsList);
        getSumsList();
        mInviteRankingMap.put("sums", mSumsList);
        showProgressDialog();
        NoHttpUtils.httpPost(TaskCenterConstant.BI_GETDATA, mInviteRankingMap, mOnResponseListener, 1);
    }

    private void getWeekRank() {
        //筛选的条件
        getUnitIdList1();//UnitId

        getWeekStartList3();

        getWeekEndList4();
        //清一遍再添加 以保证每次请求都可以用这个集合
        mInviteRankFilterList.clear();
        mInviteRankFilterList.add(mInviteRankFilterBean1);//暂时不传 石生未写好
        mInviteRankFilterList.add(mInviteRankFilterBean3);
        mInviteRankFilterList.add(mInviteRankFilterBean4);

        mInviteRankingMap.put("dataSet", "inviter_week");
        mInviteRankingMap.put("filters", mInviteRankFilterList);
        mInviteRankingMap.put("ifCount", "true");
        mInviteRankingMap.put("ifDistinct", "true");
        mInviteRankingMap.put("page", 1);
        mInviteRankingMap.put("size", 8);
        mInviteRankingMap.put("orders", mOrderList);
        mInviteRankingMap.put("selects", mSelectsList);
        getSumsList();
        mInviteRankingMap.put("sums", mSumsList);
        showProgressDialog();
        NoHttpUtils.httpPost(TaskCenterConstant.BI_GETDATA, mInviteRankingMap, mOnResponseListener, 1);
    }

    private void getMonthRank() {
        getUnitIdList1();//为mInviteRankFilterList准备参数
        getMonthList5();
        mInviteRankFilterList.clear();
        mInviteRankFilterList.add(mInviteRankFilterBean1);
        mInviteRankFilterList.add(mInviteRankFilterBean5);
        mInviteRankingMap.put("dataSet", "inviter_month");
        mInviteRankingMap.put("filters", mInviteRankFilterList);
        mInviteRankingMap.put("ifCount", "true");
        mInviteRankingMap.put("ifDistinct", "true");
        mInviteRankingMap.put("page", 1);
        mInviteRankingMap.put("size", 8);
        mInviteRankingMap.put("orders", mOrderList);
        mInviteRankingMap.put("selects", mSelectsList);
        getSumsList();
        mInviteRankingMap.put("sums", mSumsList);
        showProgressDialog();
        NoHttpUtils.httpPost(TaskCenterConstant.BI_GETDATA, mInviteRankingMap, mOnResponseListener, 1);
    }

    private void getYearRank() {
        getUnitIdList1();//为mInviteRankFilterList准备参数
        getYearList6();
        mInviteRankFilterList.clear();
        mInviteRankFilterList.add(mInviteRankFilterBean1);
        mInviteRankFilterList.add(mInviteRankFilterBean6);
        mInviteRankingMap.put("dataSet", "inviter_year");
        mInviteRankingMap.put("filters", mInviteRankFilterList);
        mInviteRankingMap.put("ifCount", "true");
        mInviteRankingMap.put("ifDistinct", "true");
        mInviteRankingMap.put("page", 1);
        mInviteRankingMap.put("size", 8);
        mInviteRankingMap.put("orders", mOrderList);
        mInviteRankingMap.put("selects", mSelectsList);
        getSumsList();
        mInviteRankingMap.put("sums", mSumsList);
        showProgressDialog();
        NoHttpUtils.httpPost(TaskCenterConstant.BI_GETDATA, mInviteRankingMap, mOnResponseListener, 1);
    }

    private void getUnitIdList1() {
        mInviteRankFilterBean1 = new InviteRankFilterBean();
        mInviteRankFilterBean1.setColumn("business_unit_id");
        mInviteRankFilterBean1.setType("in");
        mInviteRankFilterBean1.setValues(mBussUnitValueList);
    }

    private void getDayList2() {
        mInviteRankFilterBean2 = new InviteRankFilterBean();
        mInviteRankFilterBean2.setColumn("inviter_day");
        mInviteRankFilterBean2.setType("in");
        List<String> dayValueList = new ArrayList<>();
        dayValueList.clear();
        dayValueList.add(mDayDate);
        mInviteRankFilterBean2.setValues(dayValueList);
    }

    private void getWeekStartList3() {
        mInviteRankFilterBean3 = new InviteRankFilterBean();
        mInviteRankFilterBean3.setColumn("week_startday");
        mInviteRankFilterBean3.setType("in");
        List<String> weekStartValueList = new ArrayList();
        weekStartValueList.clear();
        weekStartValueList.add(mStartWeekDate);
        mInviteRankFilterBean3.setValues(weekStartValueList);
    }

    private void getWeekEndList4() {
        mInviteRankFilterBean4 = new InviteRankFilterBean();
        mInviteRankFilterBean4.setColumn("week_endday");
        mInviteRankFilterBean4.setType("in");
        List<String> weekEndValueList = new ArrayList();
        weekEndValueList.clear();
        weekEndValueList.add(mEndWeekDate);
        mInviteRankFilterBean4.setValues(weekEndValueList);
    }

    private void getMonthList5() {
        mInviteRankFilterBean5 = new InviteRankFilterBean();
        mInviteRankFilterBean5.setColumn("inviter_month");
        mInviteRankFilterBean5.setType("in");
        List<String> monthValueList = new ArrayList<>();
        monthValueList.add(mMonthDate);
        mInviteRankFilterBean5.setValues(monthValueList);
    }

    private void getYearList6() {
        mInviteRankFilterBean6 = new InviteRankFilterBean();
        mInviteRankFilterBean6.setColumn("inviter_year");
        mInviteRankFilterBean6.setType("in");
        List<String> yearVlaueList = new ArrayList<>();
        yearVlaueList.clear();
        yearVlaueList.add(mYearDate);
        mInviteRankFilterBean6.setValues(yearVlaueList);
    }

    private void getInviteRankOrderBean() {
        mOrderList = new ArrayList<>();
        mInviteRankOrderBean = new InviteRankOrderBean();
        mInviteRankOrderBean.setColumn("invite_ranking");
        mInviteRankOrderBean.setType("asc");//升序
        mOrderList.add(mInviteRankOrderBean);
    }

    private void getSelectsList() {
        mSelectsList = new ArrayList<>();
        mSelectsList.add("inviter_id");
        mSelectsList.add("inviter_name");
        mSelectsList.add("register_qty");
        mSelectsList.add("inviter_url");
        mSelectsList.add("invite_ranking");
    }

    private void getSumsList() {
        mSumsList = new ArrayList<>();
        mSumsList.add("register_qty");
    }

    private void getLessDay(int day) {
        mCalendarDay1 = Calendar.getInstance(Locale.CHINA);
        mCalendarDay1.add(Calendar.DATE, day + 1);
        mEndDayData = mDataFormatDate.format(mCalendarDay1.getTime());

        mCalendarDay = Calendar.getInstance(Locale.CHINA);
        mCalendarDay.add(Calendar.DATE, day);
        mTvData.setText(mDateFormater.format(mCalendarDay.getTime()));
        mDayDate = mDataFormatDate.format(mCalendarDay.getTime());
        LogUtils.showLog("getLessDay       " + mDayDate + "        " + mEndDayData);
        //        mCalendarDay.setTime(mBeginDate);
        //        mCalendarDay.set(Calendar.DATE, mCalendarDay.get(Calendar.DATE) + day);
        //        mTvData.setText(mDateFormater.format(mCalendarDay.getTime()));
        //        mDayDate = mDataFormatDate.format(mCalendarDay.getTime());
        getDayRank();
    }

    private void getMoreDay(int day) {
        mCalendarDay1 = Calendar.getInstance(Locale.CHINA);
        mCalendarDay1.add(Calendar.DATE, day + 1);
        String endDayData = mDataFormatDate.format(mCalendarDay1.getTime());

        mCalendarDay = Calendar.getInstance(Locale.CHINA);
        mCalendarDay.add(Calendar.DATE, day);
        mTvData.setText(mDateFormater.format(mCalendarDay.getTime()));
        mDayDate = mDataFormatDate.format(mCalendarDay.getTime());
        LogUtils.showLog("getMoreDay       " + mDayDate + "        " + endDayData);

        //        mCalendarDay.setTime(mBeginDate);
        //        mCalendarDay.set(Calendar.DATE, mCalendarDay.get(Calendar.DATE) + day);
        //        mTvData.setText(mDateFormater.format(mCalendarDay.getTime()));
        //        mDayDate = mDataFormatDate.format(mCalendarDay.getTime());
        getDayRank();
    }

    private void getLessMonth(int month) {
        mCalendarMonth1 = Calendar.getInstance(Locale.CHINA);
        mCalendarMonth1.add(Calendar.MONTH, month);
        mCalendarMonth1.set(Calendar.DAY_OF_MONTH,mCalendarMonth1.getActualMaximum(Calendar.DAY_OF_MONTH));
        mEndMonthData = mDataFormatDateEnd.format(mCalendarMonth1.getTime());
        mCalendarMonth1.set(Calendar.DAY_OF_MONTH,1);
        mStartMonthData = mDataFormatDate.format(mCalendarMonth1.getTime());

        mCalendarMonth = Calendar.getInstance(Locale.CHINA);
        mCalendarMonth.add(Calendar.MONTH, month);
        mTvData.setText(mSdfMonth.format(mCalendarMonth.getTime()));
        mMonthDate = mSdfMonthDate.format(mCalendarMonth.getTime());
        LogUtils.showLog("getLessMonth" + "    " + mStartMonthData + "      " + mEndMonthData);
        getMonthRank();
    }

    private void getMoreMonth(int month) {
        mCalendarMonth1 = Calendar.getInstance(Locale.CHINA);
        mCalendarMonth1.add(Calendar.MONTH, month);
        mCalendarMonth1.set(Calendar.DAY_OF_MONTH,mCalendarMonth1.getActualMaximum(Calendar.DAY_OF_MONTH));
        mEndMonthData = mDataFormatDateEnd.format(mCalendarMonth1.getTime());
        mCalendarMonth1.set(Calendar.DAY_OF_MONTH,1);
        mStartMonthData = mDataFormatDate.format(mCalendarMonth1.getTime());


        mCalendarMonth = Calendar.getInstance(Locale.CHINA);
        mCalendarMonth.add(Calendar.MONTH, month);
        mTvData.setText(mSdfMonth.format(mCalendarMonth.getTime()));
        mMonthDate = mSdfMonthDate.format(mCalendarMonth.getTime());
//        mStartMonthData = mDataFormatDate.format(mCalendarMonth.getTime());

        LogUtils.showLog("getMoreMonth" + "    " + mStartMonthData + "      " + mEndMonthData);
        getMonthRank();
    }

    private void getLessYear(int year) {
        mCalendarYear1 = Calendar.getInstance(Locale.CHINA);
        mCalendarYear1.add(Calendar.YEAR, year);
        mCalendarYear1.set(Calendar.DAY_OF_YEAR,mCalendarYear1.getActualMaximum(Calendar.DAY_OF_YEAR));
        mEndYearData = mDataFormatDateEnd.format(mCalendarYear1.getTime());
        mCalendarYear1.set(Calendar.DAY_OF_YEAR, 1);
        mStartYearData = mDataFormatDate.format(mCalendarYear1.getTime());

        mCalendarYear = Calendar.getInstance(Locale.CHINA);
        mCalendarYear.add(Calendar.YEAR, year);
        mTvData.setText(mSdfYear.format(mCalendarYear.getTime()));
        mYearDate = mSdfYearDate.format(mCalendarYear.getTime());


        LogUtils.showLog("getMoreYear" + "    " + mStartYearData + "      " + mEndYearData);
        getYearRank();
    }

    private void getMoreYear(int year) {
        mCalendarYear1 = Calendar.getInstance(Locale.CHINA);
        mCalendarYear1.add(Calendar.YEAR, year);
        mCalendarYear1.set(Calendar.DAY_OF_YEAR,mCalendarYear1.getActualMaximum(Calendar.DAY_OF_YEAR));
        mEndYearData = mDataFormatDateEnd.format(mCalendarYear1.getTime());
        mCalendarYear1.set(Calendar.DAY_OF_YEAR, 1);
        mStartYearData = mDataFormatDate.format(mCalendarYear1.getTime());

        mCalendarYear = Calendar.getInstance(Locale.CHINA);
        mCalendarYear.add(Calendar.YEAR, year);
        mTvData.setText(mSdfYear.format(mCalendarYear.getTime()));
        mYearDate = mSdfYearDate.format(mCalendarYear.getTime());

        LogUtils.showLog("getMoreYear" + "    " + mStartYearData + "      " + mEndYearData);
        getYearRank();
    }

    private void getLessWeek(int week) {
        //获取当前周
        mCalendarWeek.setFirstDayOfWeek(Calendar.MONDAY);
        //当前时间，貌似多余，其实是为了所有可能的系统一致
        mCalendarWeek.setTimeInMillis(System.currentTimeMillis());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        mCalendarWeek.add(Calendar.DAY_OF_WEEK, week);
        LogUtils.showLog(mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeekDate = mDataFormatDate.format(mCalendarWeek.getTime());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        mEndWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mEndWeekDate = mDataFormatDateEnd.format(mCalendarWeek.getTime());
        mTvData.setText(mStartWeek + "-" + mEndWeek);
        getWeekRank();
    }

    private void getMoreWeek(int week) {
        //获取当前周
        mCalendarWeek.setFirstDayOfWeek(Calendar.MONDAY);
        //当前时间，貌似多余，其实是为了所有可能的系统一致
        mCalendarWeek.setTimeInMillis(System.currentTimeMillis());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        mCalendarWeek.add(Calendar.DAY_OF_WEEK, week);
        LogUtils.showLog(mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeekDate = mDataFormatDate.format(mCalendarWeek.getTime());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        mEndWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mEndWeekDate = mDataFormatDateEnd.format(mCalendarWeek.getTime());
        mTvData.setText(mStartWeek + "-" + mEndWeek);
        getWeekRank();
    }


    private void getCurData() {
        mCalendarWeek = Calendar.getInstance(Locale.CHINA);
        //        mCalendarDay = Calendar.getInstance(Locale.CHINA);
        mBeginDate = new Date();

        mDateFormater = new SimpleDateFormat("yyyy年MM月dd日");
        mDataFormatDate = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        mDataFormatDateEnd = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
        //获取当前周
        mCalendarWeek.setFirstDayOfWeek(Calendar.MONDAY);
        //当前时间，貌似多余，其实是为了所有可能的系统一致
        mCalendarWeek.setTimeInMillis(System.currentTimeMillis());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        LogUtils.showLog(mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mStartWeekDate = mDataFormatDate.format(mCalendarWeek.getTime());
        mCalendarWeek.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        mEndWeekDate = mDataFormatDateEnd.format(mCalendarWeek.getTime());
        mEndWeek = (mDateFormater.format(mCalendarWeek.getTime()));
        mTvData.setText(mStartWeek + "-" + mEndWeek);
    }

    private void setRank() {
        if (mLlNoData.getVisibility() == View.VISIBLE) {
            mLlNoData.setVisibility(View.INVISIBLE);
            mLlData.setVisibility(View.VISIBLE);
        }
        if (mDataList.size() > 0 && mDataList.get(0).getRegisterQty() > 0) {
            mHnv1.setVisibility(View.VISIBLE);
            mCiv1.setVisibility(View.VISIBLE);
            mTv1.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(0).getInviterUrl(), mCiv1);
            mTv1.setText(mDataList.get(0).getInviterName());
            mHnv1.setData(mDataList.get(0).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.common_color_80_ff1f1f));
            mNo1.setVisibility(View.VISIBLE);
        }
        if (mDataList.size() > 1 && mDataList.get(1).getRegisterQty() > 0) {
            mHnv2.setVisibility(View.VISIBLE);
            mCiv2.setVisibility(View.VISIBLE);
            mTv2.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(1).getInviterUrl(), mCiv2);
            mTv2.setText(mDataList.get(1).getInviterName());
            mHnv2.setData(mDataList.get(1).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.common_color_80_f7a82f));
            mNo2.setVisibility(View.VISIBLE);
        }
        if (mDataList.size() > 2 && mDataList.get(2).getRegisterQty() > 0) {
            mHnv3.setVisibility(View.VISIBLE);
            mCiv3.setVisibility(View.VISIBLE);
            mTv3.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(2).getInviterUrl(), mCiv3);
            mTv3.setText(mDataList.get(2).getInviterName());
            mHnv3.setData(mDataList.get(2).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_cc337cff));
            mNo3.setVisibility(View.VISIBLE);
        }
        if (mDataList.size() > 3 && mDataList.get(3).getRegisterQty() > 0) {
            mHnv4.setVisibility(View.VISIBLE);
            mCiv4.setVisibility(View.VISIBLE);
            mTv4.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(3).getInviterUrl(), mCiv4);
            mTv4.setText(mDataList.get(3).getInviterName());
            mHnv4.setData(mDataList.get(3).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_55_337cff));
        }
        if (mDataList.size() > 4 && mDataList.get(4).getRegisterQty() > 0) {
            mHnv5.setVisibility(View.VISIBLE);
            mCiv5.setVisibility(View.VISIBLE);
            mTv5.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(4).getInviterUrl(), mCiv5);
            mTv5.setText(mDataList.get(4).getInviterName());
            mHnv5.setData(mDataList.get(4).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_55_337cff));
        }
        if (mDataList.size() > 5 && mDataList.get(5).getRegisterQty() > 0) {
            mHnv6.setVisibility(View.VISIBLE);
            mCiv6.setVisibility(View.VISIBLE);
            mTv6.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(5).getInviterUrl(), mCiv6);
            mTv6.setText(mDataList.get(5).getInviterName());
            mHnv6.setData(mDataList.get(5).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_55_337cff));
        }
        if (mDataList.size() > 6 && mDataList.get(6).getRegisterQty() > 0) {
            mHnv7.setVisibility(View.VISIBLE);
            mCiv7.setVisibility(View.VISIBLE);
            mTv7.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(6).getInviterUrl(), mCiv7);
            mTv7.setText(mDataList.get(6).getInviterName());
            mHnv7.setData(mDataList.get(6).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_55_337cff));
        }
        if (mDataList.size() > 7 && mDataList.get(7).getRegisterQty() > 0) {
            mHnv8.setVisibility(View.VISIBLE);
            mCiv8.setVisibility(View.VISIBLE);
            mTv8.setVisibility(View.VISIBLE);
            BaseApplication.getApplicationInstance().displayImg(mDataList.get(7).getInviterUrl(), mCiv8);
            mTv8.setText(mDataList.get(7).getInviterName());
            mHnv8.setData(mDataList.get(7).getRegisterQty(), mDataList.get(0).getRegisterQty(), getResources().getColor(R.color.blue_55_337cff));
        }
    }

    private void setAllInvisible() {
        mNo1.setVisibility(View.INVISIBLE);
        mNo2.setVisibility(View.INVISIBLE);
        mNo3.setVisibility(View.INVISIBLE);
        mHnv1.setVisibility(View.INVISIBLE);
        mHnv2.setVisibility(View.INVISIBLE);
        mHnv3.setVisibility(View.INVISIBLE);
        mHnv4.setVisibility(View.INVISIBLE);
        mHnv5.setVisibility(View.INVISIBLE);
        mHnv6.setVisibility(View.INVISIBLE);
        mHnv7.setVisibility(View.INVISIBLE);
        mHnv8.setVisibility(View.INVISIBLE);
        mCiv1.setVisibility(View.INVISIBLE);
        mCiv2.setVisibility(View.INVISIBLE);
        mCiv3.setVisibility(View.INVISIBLE);
        mCiv4.setVisibility(View.INVISIBLE);
        mCiv5.setVisibility(View.INVISIBLE);
        mCiv6.setVisibility(View.INVISIBLE);
        mCiv7.setVisibility(View.INVISIBLE);
        mCiv8.setVisibility(View.INVISIBLE);
        mTv1.setVisibility(View.INVISIBLE);
        mTv2.setVisibility(View.INVISIBLE);
        mTv3.setVisibility(View.INVISIBLE);
        mTv4.setVisibility(View.INVISIBLE);
        mTv5.setVisibility(View.INVISIBLE);
        mTv6.setVisibility(View.INVISIBLE);
        mTv7.setVisibility(View.INVISIBLE);
        mTv8.setVisibility(View.INVISIBLE);
    }

    private void setEveryTvNormal() {
        isDay = false;
        isWeek = false;
        isMonth = false;
        isYear = false;
        mTvDay.setBackground(mActivity.getResources().getDrawable(R.drawable.left_circle_c1_line_shape));
        mTvDay.setTextColor(mActivity.getResources().getColor(R.color.common_color_c1_337cff));
        mTvWeek.setBackground(mActivity.getResources().getDrawable(R.drawable.rect_c1_line_shape));
        mTvWeek.setTextColor(mActivity.getResources().getColor(R.color.common_color_c1_337cff));
        mTvMonth.setBackground(mActivity.getResources().getDrawable(R.drawable.rect_c1_line_shape));
        mTvMonth.setTextColor(mActivity.getResources().getColor(R.color.common_color_c1_337cff));
        mTvYear.setBackground(mActivity.getResources().getDrawable(R.drawable.right_circle_c1_line_shape));
        mTvYear.setTextColor(mActivity.getResources().getColor(R.color.common_color_c1_337cff));
    }

    private void initView() {
        mStateLayout = findView(mView, R.id.sl_layout);
        mLlNoData = findView(mView, R.id.ll_no_data);
        mLlData = findView(mView, R.id.ll_data);
        mEsv = findView(mView, R.id.esv_elastic);
        mTvDay = findView(mView, R.id.tv_day);
        mTvWeek = findView(mView, R.id.tv_week);
        mTvMonth = findView(mView, R.id.tv_month);
        mTvYear = findView(mView, R.id.tv_year);
        mIvLeft = findView(mView, R.id.iv_left);
        mIvRight = findView(mView, R.id.iv_right);
        mTvData = findView(mView, R.id.tv_data);
        LinearLayout ll1 = findView(mView, R.id.ll1);
        LinearLayout ll2 = findView(mView, R.id.ll2);
        LinearLayout ll3 = findView(mView, R.id.ll3);
        LinearLayout ll4 = findView(mView, R.id.ll4);
        LinearLayout ll5 = findView(mView, R.id.ll5);
        LinearLayout ll6 = findView(mView, R.id.ll6);
        LinearLayout ll7 = findView(mView, R.id.ll7);
        LinearLayout ll8 = findView(mView, R.id.ll8);
        mCiv1 = findView(mView, R.id.civ1);
        mNo1 = findView(mView, R.id.no1);
        mCiv2 = findView(mView, R.id.civ2);
        mNo2 = findView(mView, R.id.no2);
        mCiv3 = findView(mView, R.id.civ3);
        mNo3 = findView(mView, R.id.no3);
        mCiv4 = findView(mView, R.id.civ4);
        mCiv5 = findView(mView, R.id.civ5);
        mCiv6 = findView(mView, R.id.civ6);
        mCiv7 = findView(mView, R.id.civ7);
        mCiv8 = findView(mView, R.id.civ8);
        mTv1 = findView(mView, R.id.tv1);
        mTv2 = findView(mView, R.id.tv2);
        mTv3 = findView(mView, R.id.tv3);
        mTv4 = findView(mView, R.id.tv4);
        mTv5 = findView(mView, R.id.tv5);
        mTv6 = findView(mView, R.id.tv6);
        mTv7 = findView(mView, R.id.tv7);
        mTv8 = findView(mView, R.id.tv8);
        mHnv1 = findView(mView, R.id.hnv1);
        mHnv2 = findView(mView, R.id.hnv2);
        mHnv3 = findView(mView, R.id.hnv3);
        mHnv4 = findView(mView, R.id.hnv4);
        mHnv5 = findView(mView, R.id.hnv5);
        mHnv6 = findView(mView, R.id.hnv6);
        mHnv7 = findView(mView, R.id.hnv7);
        mHnv8 = findView(mView, R.id.hnv8);

        mTvTotalNum = findView(mView, R.id.tv_total_num);
        mTvMore = findView(mView, R.id.tv_more);
        mTvDay.setOnClickListener(this);
        mTvWeek.setOnClickListener(this);
        mTvMonth.setOnClickListener(this);
        mTvYear.setOnClickListener(this);
        mIvLeft.setOnClickListener(this);
        mIvRight.setOnClickListener(this);
        ll1.setOnClickListener(this);
        ll2.setOnClickListener(this);
        ll3.setOnClickListener(this);
        ll4.setOnClickListener(this);
        ll5.setOnClickListener(this);
        ll6.setOnClickListener(this);
        ll7.setOnClickListener(this);
        ll8.setOnClickListener(this);
        mTvMore.setOnClickListener(this);
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }
}
